package com.knife.blog.domain;

import com.knife.dbo.IObject;
import com.knife.util.CommUtil;

import java.io.Serializable;
import java.text.SimpleDateFormat;

public class BlogNewsDoc implements IObject, Serializable {

	private static final long serialVersionUID = 1L;

	private static final SimpleDateFormat df = new SimpleDateFormat("yyyyMMdd");

	// 属性部份

	private String cid;
	private String dirsn;
	private String newsdirsn;
	private String dirpath;
	private String newsdirpath;
	private String title;
	private String content;
	private String intro;
	private String files;
	private String imgs;
	private String keywords;
	private String url;
	private String template;
	private Integer readtimes;
	private java.util.Date displaytime;
	private String tagpic;
	private String source;
	private Integer enablereview;
	private Integer guestreview;
	private Integer publish;
	private Integer enablerss;
	private Integer onlyrssintro;
	private Integer topmessage;
	private Integer types;
	private Integer status;
	private Integer elite;
	private String inputuser;
	private java.util.Date inputtime;
	private Integer replynum;
	private String circlesn;
	
	//自动映射部份
	public String getTableName() {
		return "blognewsdoc";
	}

	public String getKeyField() {
		return "cid";
	}

	public String getKeyGenerator() {
		return "com.knife.dbo.RandomIdGenerator";
	}

	public String htmlUrl() {
		String ret = "/blogNewsDoc.do?parameter=show&cid=" + this.getCid();
		// if(this.vrtype==null || "".equals(this.vrtype)){
		if (this.inputtime != null)
			ret = "/html/blog/" + df.format(this.inputtime) + "/" + this.cid
					+ ".htm";
		// }
		return ret;
	}

	public String staticHtmlUrl() {
		String ret = "";
		if (this.inputtime != null) {
			ret = "/html/blog/" + df.format(this.inputtime) + "/" + this.cid + ".htm";
//			ret = "/"+domain+"/html/" + df.format(this.inputtime) + "/" + this.cid
//			+ ".htm";
		}
		return ret;
	}

	public void changeElite()
	{
		if(this.elite==null || this.elite.intValue()==1)
			this.elite=new Integer(1);
		else if(this.elite.intValue()!=2) this.elite=new Integer(0);
	}
	
	public void  changeHead()
	{
		if(this.elite==null || this.elite.intValue()==2)
			this.elite=new Integer(2);
		else if(this.elite.intValue()!=1) this.elite=new Integer(0);
	}
	// getter及setter方法

	public String getCid() {
		return cid;
	}

	public void setCid(String cid) {
		this.cid = cid;
	}

	public String getDirsn() {
		return dirsn;
	}

	public void setDirsn(String dirSn) {
		this.dirsn = dirSn;
	}

	public String getNewsdirsn() {
		return newsdirsn;
	}

	public void setNewsdirsn(String newsDirSn) {
		this.newsdirsn = newsDirSn;
	}

	public String getDirpath() {
		return dirpath;
	}

	public void setDirpath(String dirPath) {
		this.dirpath = dirPath;
	}

	public String getNewsdirpath() {
		return newsdirpath;
	}

	public void setNewsdirpath(String newsDirPath) {
		this.newsdirpath = newsDirPath;
	}

	public String getTitle() {
		return title;
	}

	public void setTitle(String title) {
		this.title = title;
	}

	public String getContent() {
		return content;
	}

	public void setContent(String content) {
		this.content = content;
	}

	public String getIntro() {
		if (!CommUtil.hasLength(intro))
			return CommUtil.substring(this.content, 250);
		return intro;
	}

	public void setIntro(String tntro) {
		this.intro = tntro;
	}

	public String getFiles() {
		return files;
	}

	public void setFiles(String files) {
		this.files = files;
	}

	public String getImgs() {
		return imgs;
	}

	public void setImgs(String imgs) {
		this.imgs = imgs;
	}

	public String getKeywords() {
		return keywords;
	}

	public void setKeywords(String keywords) {
		this.keywords = keywords;
	}

	public String getUrl() {
		return url;
	}

	public void setUrl(String url) {
		this.url = url;
	}

	public String getTemplate() {
		return template;
	}

	public void setTemplate(String template) {
		this.template = template;
	}

	public Integer getReadtimes() {
		return readtimes;
	}

	public void setReadtimes(Integer readTimes) {
		this.readtimes = readTimes;
	}

	public java.util.Date getDisplaytime() {
		return displaytime;
	}

	public void setDisplaytime(java.util.Date displaytime) {
		this.displaytime = displaytime;
	}

	public String getTagpic() {
		return tagpic;
	}

	public void setTagpic(String tagPic) {
		this.tagpic = tagPic;
	}

	public String getSource() {
		return source;
	}

	public void setSource(String source) {
		this.source = source;
	}

	public Integer getEnablereview() {
		return enablereview;
	}

	public void setEnablereview(Integer enableReview) {
		this.enablereview = enableReview;
	}

	public Integer getGuestreview() {
		return guestreview;
	}

	public void setGuestreview(Integer guestReview) {
		this.guestreview = guestReview;
	}

	public Integer getPublish() {
		return publish;
	}

	public void setPublish(Integer publish) {
		this.publish = publish;
	}

	public Integer getEnablerss() {
		return enablerss;
	}

	public void setEnablerss(Integer enableRss) {
		this.enablerss = enableRss;
	}

	public Integer getOnlyrssintro() {
		return onlyrssintro;
	}

	public void setOnlyrssintro(Integer onlyRssIntro) {
		this.onlyrssintro = onlyRssIntro;
	}

	public Integer getTopmessage() {
		return topmessage;
	}

	public void setTopmessage(Integer topMessage) {
		this.topmessage = topMessage;
	}

	public Integer getTypes() {
		return types;
	}

	public void setTypes(Integer types) {
		this.types = types;
	}

	public Integer getStatus() {
		return status;
	}

	public void setStatus(Integer status) {
		this.status = status;
	}

	public String getInputuser() {
		return inputuser;
	}

	public void setInputuser(String inputuser) {
		this.inputuser = inputuser;
	}

	public java.util.Date getInputtime() {
		return inputtime;
	}

	public void setInputtime(java.util.Date inputtime) {
		this.inputtime = inputtime;
	}

	public Integer getReplynum() {
		return replynum;
	}

	public void setReplynum(Integer replyNum) {
		this.replynum = replyNum;
	}

	public Integer getElite() {
		return elite;
	}

	public void setElite(Integer elite) {
		this.elite = elite;
	}

	public String getCirclesn() {
		return circlesn;
	}

	public void setCirclesn(String circleSn) {
		this.circlesn = circleSn;
	}
}